<template>
  <el-tabs v-model="activeName" v-loading="loading">
    <el-tab-pane label="特色配置" name="first">
      <el-card class="box-card">
				
        <el-form ref="featureParam" :model="featureParam" label-width="120px">
          <el-row :gutter="15">
						<el-col :span="22">
              <el-form-item label="停车规则" prop="parkrule" :rules="[
                ]">
                <el-input type="textarea" rows="8" v-model="featureParam.parkrule" placeholder="停车规则"></el-input>
              </el-form-item>
						</el-col>
            <el-col :span="24">
             <el-form-item>
              <el-button type="primary" @click="doSubmitBack()">保存</el-button>
            </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
    </el-tab-pane>
  </el-tabs>
</template>
<script>
  import ElUploadExt from '@/components/elUploadExt'
  export default {
    data() {
      return {
        activeName: 'first',
        loading: false,
        featureParam: {
					parkrule: ""
        }
      }
    },
    activated() {
      this.refreshList()
    },
    components: {
      ElUploadExt
    },
    methods: {
      // 获取数据列表
      refreshList() {
        this.$http({
          url: '/smis/config/jfConfig/queryByKey',
          method: 'post',
          params: {
            'keyStr': "featureParam"
          }
        }).then(({
          data
        }) => {
          if (data && data.success) {
            console.log(data)
            for(var key in (data.data||{})) {
              if(this.featureParam.hasOwnProperty(key)) {
                this.featureParam[key] = data.data[key]
              }
            }
          }
        })
      },
      doSubmitBack() {
        this.loading = true
        this.$http({
          url: `/smis/config/jfConfig/saveConfig`,
          method: 'post',
          data: {
            keyStr: "featureParam",
            valueStr: JSON.stringify(this.featureParam)
          }
        }).then(({
          data
        }) => {
          if (data && data.success) {
            this.$message.success(data.msg)
            this.refreshList()
          }
          this.loading = false
        })
      }
    }
  }
</script>
